/**
 * 
 */
package org.tempuri;

import java.io.UnsupportedEncodingException;
import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

/**
 * @author Administrator
 * 
 */
public class WebServiceTest {
	
    public static String sendSms(String userid,String password,String phone,String content,String xh){
    	WmgwLocator wmgwLocator = new WmgwLocator();
    	String strArgs[] = new String[10];
    	strArgs[0] = userid;		
		strArgs[1] = password;		
		strArgs[2] = phone;
		strArgs[3] = content;	
		strArgs[4] = "1";			
		strArgs[5] = "*";		
		String strMsg="";
		try {
			strMsg = new String(strArgs[3].getBytes("gb2312"));
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String result="";
		try {
			result=wmgwLocator.getwmgwSoap().mongateCsSpSendSmsNew(strArgs[0],strArgs[1], strArgs[2], strMsg,Integer.valueOf(strArgs[4]).intValue(),xh);
		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (ServiceException e) {
			e.printStackTrace();
		}
    	return result;
    }
	/**
	 * @param args
	 * @throws UnsupportedEncodingException 
	 */
	public static void main(String[] args) throws UnsupportedEncodingException {
		WmgwLocator wmgwLocator = new WmgwLocator();
		String strArgs[] = new String[10];
		strArgs[0] = "SENDID";		//�ʺ�
		strArgs[1] = "123456";		//����
		strArgs[2] = "13636445902";//�ֻ��
		strArgs[3] = "TEST测试";	//������Ϣ
		strArgs[4] = "1";			//�ֻ����
		strArgs[5] = "*";			//�Ӷ˿� 
		String strMsg = new String(strArgs[3].getBytes("GB2312"));//web�����ֻ����UTF��8��ʽ�ı���
		//mongateCsSendSmsEx
		try {
			System.out.println("Test mongateCsSendSmsEx ...");
			System.out.println("back value is :"
					+ wmgwLocator.getwmgwSoap().mongateCsSpSendSmsNew(strArgs[0],strArgs[1], strArgs[2], strMsg, Integer.valueOf(strArgs[4]).intValue(),"1234"));
			System.out.println("send mongateCsSendSmsEx end !");
			System.out.println();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
//		//mongateCsSendSmsExNew
//		try {
//			System.out.println("Test mongateCsSendSmsExNew ...");
//			System.out.println("back value is :"
//					+ wmgwLocator.getwmgwSoap().mongateCsSpSendSmsNew(strArgs[0],
//							strArgs[1], strArgs[2], strMsg, Integer.valueOf(strArgs[4]).intValue(),strArgs[5]));
//			System.out.println("send mongateCsSendSmsExNew end !");
//			System.out.println();
//		} catch (RemoteException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (ServiceException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//		
//		//mongateCsGetStatusReportExEx
//		try {
//			System.out.println("Test mongateCsGetStatusReportExEx ...");
//			String[] strRet = wmgwLocator.getwmgwSoap().mongateCsGetStatusReportExEx(strArgs[0], strArgs[1]);
//			System.out.println("back value is :");
//			if (strRet != null)
//			{
//				for(int i = 0; i < strRet.length; ++i)
//				{
//					System.out.println(strRet[i]);
//				}
//			}
//			else
//			{
//				System.out.println("null");
//			}
//			System.out.println("send mongateCsGetStatusReportExEx end !");
//			System.out.println();
//		} catch (RemoteException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (ServiceException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//
//		//mongateQueryBalance
//		try {
//			System.out.println("Test mongateQueryBalance ...");
//			System.out.println("back value is :"
//					+ wmgwLocator.getwmgwSoap().mongateQueryBalance(strArgs[0], strArgs[1]));
//			System.out.println("send mongateQueryBalance end !");
//			System.out.println();
//		} catch (RemoteException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (ServiceException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//		
//		//mongateCsGetSmsExEx
//		try {
//			System.out.println("Test mongateCsGetSmsExEx ...");
//			String[] strRet = wmgwLocator.getwmgwSoap().mongateCsGetSmsExEx(strArgs[0], strArgs[1]);
//			System.out.println("back value is :");
//			if (strRet != null)
//			{
//				for(int i = 0; i < strRet.length; ++i)
//				{
//					System.out.println(strRet[i]);
//				}
//			}
//			else
//			{
//				System.out.println("null");
//			}
//			System.out.println("send mongateCsGetSmsExEx end !");
//			System.out.println();
//		} catch (RemoteException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (ServiceException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
	}
}
